1 <?php
2  session_start();
3  
if(isset($_SESSION['user']))
4  {
5
6  }
7  
else{
8   echo
"<script>location.href='login.html'</script>";
9  }
10 ?>
11 <!doctype html>
12 <html>
13 <head>
14         <title>Customer </title>
15         <style>
16             body {
17   margin:
0;
18   font-family: Arial, Helvetica, sans-serif;
19   background: #
484848;
20 }
21 .topnav {
22   overflow: hidden;
23   background-color:#8d2663;
24   height: 70px;
25   border: 3px solid #b40a70;
26 }
27
28 .topnav a {
29   
float: left;
30   color: #f2f2f2;
31   text-align: center;
32   padding: 14px 16px;
33   text-decoration: none;
34   font-size: 35px;
35   font-weight: bold;
36 }
37
38 .topnav-right {
39   
float: right;
40 }
41 fieldset {
42   background: #FAFAFA;
43     padding: 10px;
44    margin:auto;
45    max-width:450px;
46     box-shadow: 1px 1px 25px rgba(
0, 0, 0, 0.35);
47     border-radius: 10px;
48     border: 6px solid #b40a70;
49
50
51 }
52
53
54 </style>
55 </head>
56 <body>
57 <div
class="topnav">
58             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
59             <a href=
"customer.php">Customers</a>
60             <div
class="topnav-right">
61               <a href=
"logout.php">logout</a>
62             </div>
63           </div>
64 <form>
65     <button type=
"submit" formaction="phone.php" style="margin:15px;height: 30px;width: 100px;cursor:pointer;
66     border-radius:15px;
67 border: 3px solid #b40a70;background-color: #8d2663;color:#f2f2f2;font-size:15px;"
>Back</button>
68 </form>
69 <form method=
"post" action="phoneadd.php">
70 <fieldset>
71    <input type=
"text" name="id" placeholder="Enter customer id" style="width:100%;height:30px;
72     border: 2px solid #b40a70; border-radius:5px; background:transparent;"
required>
73   <br><br>
74    <input type=
"number" name="phone" placeholder="Enter phone no." style="width:100%;height:30px;
75     border: 2px solid #b40a70; border-radius:5px; background:transparent;"
required>
76   <br><br>
77   <input type=
"submit" name="submit" value="ADD" style="width:100%;height:30px;
78     border: 2px solid #b40a70; border-radius:5px; cursor:pointer;background-color: #8d2663"
>&ensp;
79   </fieldset>
80 </form>
81 </body>
82 </html>
83 <?php

84 if
(isset($_POST["submit"]))
85 {
86  
// define variables and set to empty values
87 $servername =
"localhost";
88 $username =
"root";
89 $password =
"";
90 $dbname =
"Petshop_management";
91
92 // Create connection

93 $conn =
new mysqli($servername, $username, $password, $dbname);
94 // Check connection

95 if
($conn->connect_error) {
96     die(
"Connection failed: " . $conn->connect_error);
97 }

98 //echo
" CONNECTION ESTABLISHED \r\n";
99 //echo
" INSERTION IN PROCESS";
100 $id = $_POST[
"id"];
101   $cs_phone = $_POST[
"phone"];
102  
103
104
105
106
107 $sql =
"INSERT INTO phone( cs_id,cs_phone)
108 VALUES ('$id','$cs_phone')"
;
109 if
($conn->query($sql) == TRUE) {
110   echo
'<div>
111   <h1 style=
"color:#f2f2f2;font-size:20px; font-family: "Roboto", sans-serif;margin:auto;">New record of cs_id='
112   .$id.
' inserted successfully</h1>
113      </div>
';
114 }
else {
115     echo
"Error: " . $sql . "<br>" . $conn->error;
116 }
117
118 $conn->close();
119 }
120
121 ?>


Gõ tìm kiếm nhanh...